﻿@model PrjctMngmt.Models.DashboardModel

<fieldset>
    <legend>Overview</legend>
    <!--
    <fieldset class="dashboard-entity">
        <legend>Tasks</legend>
        <div class="display-label">
            Total tasks:
        </div>
        <div class="display-field">
            @Model.TotalTasks
        </div>
        <div class="display-label">
            Finished tasks:
        </div>
        <div class="display-field">
            @Model.FinishedTasks
        </div>
        <div class="display-label">
            Unfinished tasks:
        </div>
        <div class="display-field">
            @Model.UnfinishedTasks
        </div>
    </fieldset>
    <fieldset class="dashboard-entity">
        <legend>Projects</legend>
        <div class="display-label">
            Total projects:
        </div>
        <div class="display-field">
            @Model.TotalProjects
        </div>
        <div class="display-label">
            Finished projects:
        </div>
        <div class="display-field">
            @Model.FinishedProjects
        </div>
        <div class="display-label">
            Unifinished projects:
        </div>
        <div class="display-field">
            @Model.UnfinishedProjects
        </div>
    </fieldset>
    <fieldset class="dashboard-entity">
        <legend>Issues</legend>
        <div class="display-label">
            Total issues:
        </div>
        <div class="display-field">
            @Model.TotalIssues
        </div>
        <div class="display-label">
            Finished issues:
        </div>
        <div class="display-field">
            @Model.FinishedIssues
        </div>
        <div class="display-label">
            Unifinished issues:
        </div>
        <div class="display-field">
            @Model.UnfinishedIssues
        </div>
    </fieldset>
    -->
</fieldset>

<fieldset>
    <legend>Upcoming Milestones</legend>
    @if (Model.MilestonesDuringWeek.Count() > 0 || Model.MilestonesNextWeek.Count() > 0 
        || Model.MilestonesDuringMonth.Count() > 0)
    {
        <fieldset class="dashboard-entity">
            <legend>Milestones - same week</legend>
            @foreach (var milestone in Model.MilestonesDuringWeek)
            {
                var url = @Url.Action("Details", "Milestone", new { id = "id" });
                url = url.Replace("id", milestone.MilestoneID.ToString());
            
                <a href="@url">@milestone.Name (@milestone.Project.Name)</a>
                <br />
                @milestone.DueDate
                <br />
                <br />
            }
        </fieldset>
        <fieldset class="dashboard-entity">
            <legend>Milestones - next week</legend>
            @foreach (var milestone in Model.MilestonesNextWeek)
            {
                var url = @Url.Action("Details", "Milestone", new { id = "id" });
                url = url.Replace("id", milestone.MilestoneID.ToString());
            
                <a href="@url">@milestone.Name (@milestone.Project.Name)</a>
                <br />
                @milestone.DueDate
                <br />
                <br />
            }
        </fieldset>
        <fieldset class="dashboard-entity">
            <legend>Milestones - same month</legend>
            @foreach (var milestone in Model.MilestonesDuringMonth)
            {
                var url = @Url.Action("Details", "Milestone", new { id = "id" });
                url = url.Replace("id", milestone.MilestoneID.ToString());
            
                <a href="@url">@milestone.Name (@milestone.Project.Name)</a>
                <br />
                @milestone.DueDate
                <br />
                <br />
            }
        </fieldset>
    }
    else
    {
        <p>
            No upcoming milestones this month.
        </p>
    }
</fieldset>

<fieldset>
    <legend>Upcoming Conferences</legend>
    @if (Model.ConfsDuringWeek.Count() > 0 || Model.ConfsNextWeek.Count() > 0 
        || Model.ConfsDuringMonth.Count() > 0)
    {
        <fieldset class="dashboard-entity">
            <legend>Conferences - same week</legend>
            @foreach (var conf in Model.ConfsDuringWeek)
            {
                var url = @Url.Action("Details", "Conference", new { id = "id" });
                url = url.Replace("id", conf.ConferenceID.ToString());
            
                <a href="@url">@conf.Name</a>
                <br />
                @conf.Date
                <br />
                <br />
            }
        </fieldset>
        <fieldset class="dashboard-entity">
            <legend>Conferences - next week</legend>
            @foreach (var conf in Model.ConfsNextWeek)
            {
                var url = @Url.Action("Details", "Conference", new { id = "id" });
                url = url.Replace("id", conf.ConferenceID.ToString());
            
                <a href="@url">@conf.Name</a>
                <br />
                @conf.Date
                <br />
                <br />
            }
        </fieldset>
        <fieldset class="dashboard-entity">
            <legend>Conferences - same month</legend>
            @foreach (var conf in Model.ConfsDuringMonth)
            {
                var url = @Url.Action("Details", "Conference", new { id = "id" });
                url = url.Replace("id", conf.ConferenceID.ToString());
            
                <a href="@url">@conf.Name</a>
                <br />
                @conf.Date
                <br />
                <br />
            }
        </fieldset> 
    }
    else
    {
        <p>
            No upcoming conferences this month.
        </p>   
    }
</fieldset>

<fieldset>
    <legend>Charts</legend>
    <div id="task-pie-chart">
        <img alt="Task pie chart" src='@Url.Action("TaskPieChart")' />
        <img alt="Project pie chart" src='@Url.Action("ProjectPieChart")' />
        <img alt="Issue pie chart" src='@Url.Action("IssuePieChart")' />
    </div>
</fieldset>